﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="SQuestionController.cs" company="hoandd">
//   hoandd
// </copyright>
// <summary>
//   Summary description for SQuestionController
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace DesktopModules.Surveys
{
    using System.Collections.Generic;
    using DotNetNuke.Common.Utilities;

    /// <summary>
    /// Summary description for SQuestionAnswerController
    /// </summary>
    public class SQuestionAnswerController
    {
        public SQuestionAnswerController()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        public static void AddSQuestionAnswer(SQuestionAnswerInfo obj)
        {
            DataProvider.Instance().AddSQuestionAnswer(obj.SQuestionID, obj.Answer, obj.ViewOrder);
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// deletes an object from the database
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name="">The SAnswerID of the SQuestionAnswer</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public static void DeleteSQuestionAnswer(int SAnswerID)
        {
            DataProvider.Instance().DeleteSQuestionAnswer(SAnswerID);
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// gets an object from the database
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name="">TheSAnswerID of SQuestionAnswer</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public static SQuestionAnswerInfo GetSQuestionAnswer(int SAnswerID)
        {
            return CBO.FillObject<SQuestionAnswerInfo>(DataProvider.Instance().GetSQuestionAnswer(SAnswerID));
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// gets an object from the database
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public static List<SQuestionAnswerInfo> GetSQuestionAnswers()
        {
            return CBO.FillCollection<SQuestionAnswerInfo>(DataProvider.Instance().GetSQuestionAnswers());
        }

        public static List<SQuestionAnswerInfo> GetSQuestionAnswers(int SAnswerID)
        {
            return CBO.FillCollection<SQuestionAnswerInfo>(DataProvider.Instance().GetSQuestionAnswers(SAnswerID));
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// saves an object to the database
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name="obj">The SQuestionAnswerInfo object</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public static void UpdateSQuestionAnswer(SQuestionAnswerInfo obj)
        {
            DataProvider.Instance().UpdateSQuestionAnswer(obj.SAnswerID, obj.SQuestionID, obj.Answer, obj.ViewOrder);
        }
    }
}